package com.itheima.method;

public class maxAndMin {
    public static void main(String[] args) {
        int[] arr2 = {1,5,3,6,4,87};
        int[] arr = maxAndMinprint(arr2);
    }
    public static int[] maxAndMinprint(int[] arr){
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]){
                 max = arr[i];
            }
        }
        System.out.println(max);
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (min > arr[i]){
                min = arr[i];
            }
        }
        System.out.println(min);
        int[] arr1 = {max ,min};
        return arr1;
    }
}
